<?php require_once(dirname(__FILE__).'/inc/config.inc.php');IsModelPriv('member_add');?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>添加会员</title>
<link href="templates/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="templates/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/jquery.nicescroll.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/Validform_v5.3.2_min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/laymain.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/common.js"></script>
<script type="text/javascript" src="templates/js/checkf.func.js"></script>
<script type="text/javascript" src="templates/js/getarea.js"></script>
<script type="text/javascript" src="editor/kindeditor-min.js"></script>
<script type="text/javascript" src="editor/lang/zh_CN.js"></script>
<script type="text/javascript" src="templates/js/getuploadify.js"></script>
<script type="text/javascript">
var xmlHttp;

function xmlhttprequest(){
	if(window.ActiveXObject){
		xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
	}
	else if(window.XMLHttpRequest){
		xmlHttp = new XMLHttpRequest();
	}
	else{
		alert('您的浏览器不支持Ajax技术！');
	}
}


//用户名检测
function CheckUser(){
	if(document.form.username.value == ''){
		document.getElementById('usernote').innerHTML = '请输入用户名';
	}
	else{
		if(document.form.username.value.length < 4){
			document.getElementById('usernote').innerHTML = '用户名小于4位';
			return;
		}
		xmlhttprequest();
		var username = document.getElementById('username').value;
		var url = "ajax_do.php?"+parseInt(Math.random()*(15271)+1)+'&action=checkuser&username='+username;
		xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange = check_done;
		xmlHttp.send(null);
	}
}


function check_done(){
	if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
		document.getElementById('usernote').innerHTML = xmlHttp.responseText;
		if('<span class="Validform_checktip Validform_wrong">用户名已存在</span>' == xmlHttp.responseText){
			document.getElementById('isuser').value = '0';
		}
		else{
			document.getElementById('isuser').value = '';
		}
	}
}
</script>
<script type="text/javascript">
   $(function () {
        //初始化表单验证
        $("#form").initValidform();
    });

</script>
</head>

<body class="mainbody">
<form name="form" id="form" method="post" action="member_save.php" >
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i></i><span>返回列表页</span></a>
  <a href="home.php" class="home"><i></i><span>首页</span></a>
  <i class="arrow"></i>
  <a href="member.php"><span>添加会员</span>
  <a href="javascript:location.reload();" class="reload">刷新</a> 
</div>
<div class="line10"></div>
<!--/导航栏-->

<!--内容-->
<div id="floatHead" class="content-tab-wrap">
  <div class="content-tab">
    <div class="content-tab-ul-wrap">
      <ul>
        <li><a class="selected" href="javascript:;">添加会员</a></li>
      </ul>
    </div>
  </div>
</div>

<div class="tab-content" style="overflow: visible" >
	<dl>
	<dt>用户名</dt>
	<dd><input type="text" name="username" id="username" class="input" datatype="*4-20" onblur="CheckUser();" /><input type="hidden" id="isuser" name="isuser" value="" /><span class="Validform_checktip" id="usernote"></span></dd> 
	</dl>
		<dl>
			<dt>密码</dt>
			<dd>
			<input name="password" type="password" id="password"  datatype="*6-20" nullmsg="请设置密码" errormsg="密码范围在6-20位之间" sucmsg=" " class="input" />
			</dd>
		</dl>		
		  <dl>
			<dt>确认密码</dt>
			<dd>
			<input name="repassword" type="password" id="repassword" datatype="*" recheck="password" nullmsg="请再输入一次密码" errormsg="两次输入的密码不一致" sucmsg=" "  class="input" />
			</dd>
		  </dl> 
		 <dl>
			<dt>名称</dt>
			<dd><input name="nickname" type="text" value="" id="txtRealName" class="input" /></dd>
		  </dl>
		  <dl>
			<dt>邮箱</dt>
			<dd>
			<input type="text" name="email" id="email" class="input normal" datatype="e" nullmsg="请填写邮箱" errormsg="" sucmsg=" " />
			  <span class="Validform_checktip"></span>
			</dd>
		  </dl> 
	<dl>
	
    <dt>手　机</dt>
    <dd>
     <input type="text" name="mobile" id="mobile" class="input" /> <span class="Validform_checktip"></span>
    </dd>
  </dl>
   <dl>
    <dt>会员组</dt>
    <dd>
      <div class="rule-single-select" >
       	<select name="groupid" id="groupid" >
			<?php
			$dosql->Execute("SELECT * FROM `#@__usergroup` ORDER BY id ASC");
			while($row = $dosql->GetArray())
			{	if($row['id']==2) $select='selected="selected"';else $select=''; 
				echo '<option '.$select.' value="'.$row['id'].'">'.$row['groupname'].'</option>';
			}
			?></select>
      </div>
    </dd>
  </dl>
 
   <dl>
    <dt>会员模型</dt>
    <dd>
	   <div class="rule-single-select">
		<select name="modelid"  id="modelid"  datatype="*" errormsg="请选择会员模型！" sucmsg=" ">
			<option selected="selected" value=" ">会员模型</option>
			<?php
			$dosql->Execute("SELECT * FROM `#@__usermodel` ORDER BY id ASC");
			while($row = $dosql->GetArray())
			{	
				echo '<option '.$select.' value="'.$row['id'].'">'.$row['modeltitle'].'</option>';
			}
			?></select> </div>
    </dd>
  </dl>
    <dl>
    <dt>认证</dt>
    <dd>
       <div class="rule-single-checkbox">
          <input id="enteruser" type="checkbox" name="enteruser" value="1"/>
      </div> <span class="Validform_checktip">*认证vip</span>
    </dd>
  </dl>
	   <dl>
    <dt>注册时间</dt>
    <dd>
      <input type="text" name="regtime" id="regtime" class="input rule-date-input" value="<?php echo GetDateTime(time()); ?>" readonly="readonly" />
				<script type="text/javascript" src="plugin/calendar/calendar.js"></script> 
				<script type="text/javascript">
				Calendar.setup({
					inputField     :    "regtime",
					ifFormat       :    "%Y-%m-%d %H:%M:%S",
					showsTime      :    true,
					timeFormat     :    "24"
				});
				</script>
    </dd>
  </dl>
	
</div>
<!--/内容-->

<!--工具栏-->
<div class="page-footer">
  <div class="btn-wrap">
  <input type="submit" name="btnSubmit" value="提交保存" id="btnSubmit" class="btn" />
    <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript:history.back(-1);" />
	<input type="hidden" name="action" id="action" value="add" />
  </div>
</div>
<!--/工具栏-->

</form>
</body>
</html>